package com.hllxd.hism.star.basic.service.service;

import com.hllxd.hism.star.basic.service.collect.DateUtils;
import com.hllxd.hism.star.basic.service.dao.mapper.mis.ApproverConfigMapper;
import com.hllxd.hism.star.basic.service.model.TblDataRockApproverConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wuguangxi
 * @description
 * @date 2024/1/9 16:22
 **/
@Slf4j
@Service("approverConfigService")
public class ApproverConfigServiceImpl implements ApproverConfigService {
    @Autowired
    private ApproverConfigMapper approverConfigMapper;

    @Override
    public List<TblDataRockApproverConfig> findAll() {
        return approverConfigMapper.findAll();
    }

    @Override
    public TblDataRockApproverConfig findById(Integer id) {
        if(id == null){
            return null;
        }
        return approverConfigMapper.findById(id);
    }

    @Override
    public void save(TblDataRockApproverConfig approverConfig) {
        approverConfig.setCreateTime(DateUtils.getDateTime());
        approverConfig.setActionTime(DateUtils.getDateTime());
        approverConfigMapper.save(approverConfig);
    }

    @Override
    public void modify(TblDataRockApproverConfig approverConfig) {
        approverConfig.setActionTime(DateUtils.getDateTime());
        approverConfigMapper.update(approverConfig);
    }

    @Override
    public void remove(Integer id) {
        if(id == null){
            return;
        }
        approverConfigMapper.delete(id);
    }
}
